<template>
	<view>
		<view class="sea-top">
			<view class="top-left">
				<view class="left-image">
					<image src="../../static/icons/ss.png" mode="widthFix"></image>
				</view>
				<view class="left-ipt">
					<input class="ipt-item" v-model="searchStr" @keydown.enter="goSearch(searchStr)" type="text" placeholder="在这里写下你想寻找的~" />
					
					<!-- <u--input class="ipt-item" v-model="searchStr" placeholder="在这里写下你想寻找的" prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399">
						<template slot="suffix">
							<u-icon v-show="searchStr" @click="clearSearchStr" name="close-circle-fill" color="#909399"></u-icon>
						</template>
					</u--input> -->
				</view>
				<u-icon class="ipt-clear" v-show="searchStr" @click="clearSearchStr" name="close-circle-fill" color="#afb3ba"></u-icon>
			</view>
			<view class="top-right" @click="goBack">
				取消
			</view>
		</view>
		<view class="sea-content">
			<view class="sea-box">
				<view class="cont-item" @click="naviTo(index = 0)">
					日签
				</view>
				<view class="cont-item" @click="naviTo(index = 1)">
					问答
				</view>
				<view class="cont-item" @click="naviTo(index = 2)">
					阅读
				</view>
				<view class="cont-item" @click="naviTo(index = 3)">
					长篇
				</view>
				<view class="cont-item" @click="naviTo(index = 4)">
					书影
				</view>
				<view class="cont-item" @click="naviTo(index = 5)">
					音乐
				</view>
				<view class="cont-item" @click="naviTo(index = 6)">
					收音机
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				searchStr: ''
			}
		},
		methods: {
			clearSearchStr() {
				// console.log('clear');
				this.searchStr = ''
			},
			naviTo(index) {
				uni.navigateTo({
					url: '../SearchTag/SearchTag?index=' + index
				})
			},
			goSearch(kw) {
				// console.log(kw);
				uni.navigateTo({
					url: '/pages/SearchDetails/SearchDetails?kw=' + kw
				})
			},
			goBack() {
				// 返回上一级并刷新当前页面
				this.$router.go(-1)
			}
		}
	}
</script>

<style lang="scss">
	* {
		box-sizing: border-box;
	}
	
	.sea-top {
		padding: 10px;
		display: flex;
		align-items: center;
		width: 750rpx;
		height: 100rpx;
		border-bottom: 1px solid #e8e8e8;
		
		.top-left {
			// margin: 10px;
			// padding: 10px;
			flex: 8.5;
			display: flex;
			align-items: center;
			width: 85%;
			height: 100%;
			background-color: #eaeaea;
			border-radius: 5px;
			
			.left-image {
				padding: 8px 5px 5px 5px;
				// padding: 10px;
				// width: 85%;
				// height: 100%;
				
				image {
					width: 30rpx;
					height: 30rpx;
				}
			}
			
			.left-ipt {
				width: 100%;
				// height: 100%;
				
				.ipt-item {
					width: 100%;
					// height: 64rpx;
					height: 100%;
					font-size: 12px;
				}
			}
		}
		
		.top-right {
			flex: 1.5;
			float: right;
			width: 100%;
			text-align: center;
			font-size: 12px;
		}
	}
	
	.sea-content {
		position: relative;
		width: 750rpx;
		height: 1200rpx;
		
		.sea-box {
			position: absolute;
			top: 20%;
			left: 42%;
			display: flex;
			flex-direction: column;
		}
		
		.cont-item {
			padding: 20px 10px;
			width: 100%;
			text-align: center;
			color: #5f5f5f;
		}
	}
</style>
